#ifndef __BSP_PARAM_H
#define __BSP_PARAM_H

#define PARAM_MSC_NUM_SD            0
#define PARAM_MSC_NUM_USB           2
#define PARAM_SYS_VOL               4
//#define PARAM_HSF_VOL               5
#define PARAM_LANG_ID               6
#define PARAM_RANDOM_KEY            7           //4Byte随机数
#define PARAM_BT_XOSC_CAP           0x0b        //1Byte xosc value
#define PARAM_SYS_MODE              0x0c        //系统模式记忆
#define PARAM_MSC_NUM_SD1           0x0d        //2BYTE

#if MUSIC_PLAY_POINT_EN
#define PARAM_MSC_BRKPT_SD          0x10          //14BYTE = frame_count(4byte) +  file_ptr(4byte) + fname_crc(2byte) + first_offset(4byte)
#define PARAM_MSC_BRKPT_USB         0x1a+4        //14BYTE = frame_count(4byte) +  file_ptr(4byte) + fname_crc(2byte) + first_offset(4byte)
#define PARAM_MSC_BRKPT_SD1         0x24+8        //14BYTE = frame_count(4byte) +  file_ptr(4byte) + fname_crc(2byte) + first_offset(4byte)

#define PARAM_FMRX_CHCUR            0x30+12
#define PARAM_FMRX_CHCNT            0x31+12
#define PARAM_FMRX_CHBUF            0x32+12        //26Byte
#define PARAM_FMTX_FREQ             0x4C+12        //FM TX freq 2 Byte
#define PARAM_ECHO_LEVEL            0x4E+12        //echo level 1 Byte
#define PARAM_ECHO_DELAY            0x4F+12        //echo delay 1 Byte

#define PARAM_MASTER_ADDR_VALID     0x50+12        //用于记录主耳的地址是否有效
#define PARAM_MASTER_ADDR           0x51+12        //6BYTE

#define PARAM_QR_ADDR_VALID         0x63        //用于记录是否有修改过蓝牙地址
#define PARAM_QR_ADDR               0x64        //使用修改后的蓝牙地址6byte
#define PARAM_BT_NAME_LEN           0x6a        //记录蓝牙长度最大值32
#define PARAM_BT_NAME               0x6b        //使用新的蓝牙名字32 byte
#define PARAM_RST_FLAG              0x8b        //复位标志1byte

#define PARAM_FOT_ADDR              0x8c        //4BYTE
#define PARAM_FOT_REMOTE_VER        0x90        //2BYTE
#define PARAM_FOT_HEAD_INFO         0x92        //8BYTE
#define PARAM_FOT_HASH              0x9A        //4BYTE


#else
#define PARAM_MSC_BRKPT_SD          0x10        //10BYTE = frame_count(4byte) +  file_ptr(4byte) + fname_crc(2byte)
#define PARAM_MSC_BRKPT_USB         0x1a        //10BYTE = frame_count(4byte) +  file_ptr(4byte) + fname_crc(2byte)
#define PARAM_MSC_BRKPT_SD1         0x24        //10BYTE = frame_count(4byte) +  file_ptr(4byte) + fname_crc(2byte)

#define PARAM_FMRX_CHCUR            0x30
#define PARAM_FMRX_CHCNT            0x31
#define PARAM_FMRX_CHBUF            0x32        //26Byte
#define PARAM_FMTX_FREQ             0x4C        //FM TX freq 2 Byte
#define PARAM_ECHO_LEVEL            0x4E        //echo level 1 Byte
#define PARAM_ECHO_DELAY            0x4F        //echo delay 1 Byte

#define PARAM_MASTER_ADDR_VALID     0x50        //用于记录主耳的地址是否有效
#define PARAM_MASTER_ADDR           0x51        //6BYTE

#define PARAM_QR_ADDR_VALID         0x57        //用于记录是否有修改过蓝牙地址
#define PARAM_QR_ADDR               0x58        //使用修改后的蓝牙地址6byte
#define PARAM_BT_NAME_LEN           0x5e        //记录蓝牙长度最大值32
#define PARAM_BT_NAME               0x5f        //使用新的蓝牙名字32 byte
#define PARAM_RST_FLAG              0x7f     //复位标志1byte

#define PARAM_FOT_ADDR              0x80        //4BYTE
#define PARAM_FOT_REMOTE_VER        0x84        //2BYTE
#define PARAM_FOT_HEAD_INFO         0x86        //8BYTE
#define PARAM_FOT_HASH              0x8e        //4BYTE

#endif // MUSIC_PLAY_POINT_EN

#define RTCRAM_PWROFF_FLAG          63         //软关机的标识放在RTCRAM的最后一BYTE

#if MUSIC_PLAY_POINT_EN
#define MUSIC_PARA_LEN 14
#else
#define MUSIC_PARA_LEN 10
#endif

void param_init(bool reset);
void param_sync(void);
void param_msc_num_write(void);
void param_msc_num_read(void);
void param_msc_breakpoint_write(void);
void param_msc_breakpoint_read(void);
void param_fmrx_chcur_write(void);
void param_fmrx_chcur_read(void);
void param_fmrx_chcnt_write(void);
void param_fmrx_chcnt_read(void);
void param_fmrx_chbuf_write(void);
void param_fmrx_chbuf_read(void);
void param_sys_vol_write(void);
void param_sys_vol_read(void);
void param_lang_id_write(void);
void param_lang_id_read(void);
void param_random_key_write(void);
void param_random_key_read(u8 *key);
u8 param_sys_mode_read(void);
void param_sys_mode_write(u8 mode);
void param_fmtx_freq_write(void);
void param_fmtx_freq_read(void);
void param_echo_level_write(void);
void param_echo_level_read(void);
void param_echo_delay_write(void);
void param_echo_delay_read(void);
void param_rec_num_write(void);
void param_rec_num_read(void);
void param_fot_addr_write(u8 *param);
void param_fot_addr_read(u8 *param);
void param_fot_remote_ver_write(u8 *param);
void param_fot_remote_ver_read(u8 *param);
void param_fot_head_info_write(u8 *param);
void param_fot_head_info_read(u8 *param);
void param_fot_hash_write(u8 *param);
void param_fot_hash_read(u8 *param);
#endif // __BSP_PARAM_H

